Method and apparatus for detecting repetitive pattern in image

ABSTRACT

According to an aspect of the present invention, there is provided a method of detecting a repetitive pattern. The method includes: clustering a plurality of pixels that form an input image according to color and obtaining one or more color layers composed of pixels included in each cluster; selecting one or more effective layers from the color layers, wherein each of the effective layers includes a predetermined number or more of pixel components, each composed of a plurality of pixels and having a predetermined shape or a predetermined size of area; selecting a unit pattern repeatedly disposed at different locations in each effective layer from the pixel components included in each effective layer; calculating distances between the unit patterns in each effective layer; and calculating a repetition cycle of the unit pattern of the input image based on the calculated distances in each effective layer.

This application claims priority from Korean Patent Application No.10-2013-0062249 filed on May 31, 2013 in the Korean IntellectualProperty Office, the disclosure of which is incorporated herein byreference in its entirety.

BACKGROUND OF THE INVENTION

1. Field of the Invention

The present invention relates to a method and apparatus for detecting arepetitive pattern in an image.

2. Description of the Related Art

To detect a defect in a semiconductor wafer or an organic light-emittingdiode (OLED), light-emitting diode (LED) or liquid crystal display (LCD)substrate, a technique (such as automatic defect classification) ofdetecting a defect by sensing an appearance defect is being used. Thisvisual detection technique can save production cost by detecting adefect relatively quickly and significantly reducing a defect rate.

The conventional visual detection technique detects a defect in a testimage by comparing a reference image of a wafer or substrate without adefect with the test image. Therefore, the conventional visual detectiontechnique essentially needs a reference image of a wafer or substratewithout a defect.

However, in some cases, it may be difficult to provide a referenceimage. For example, it may be technically difficult to satisfyrequirements for resolution and precision, or there may be constraintsof production cost and time needed to form a reference image for eachunit process.

In such cases, it is required to detect a defect in a test image withouta reference image.

SUMMARY OF THE INVENTION

Aspects of the present invention provide a method and apparatus foreffectively detecting a repetitive pattern in an input image in order todetect a defect by visual detection without a reference image.

Aspects of the present invention also provide a method of detecting adefect in a test image using a repetitive pattern detected in an inputimage in order to detect a defect by visual detection without areference image.

However, aspects of the present invention are not restricted to the oneset forth herein. The above and other aspects of the present inventionwill become more apparent to one of ordinary skill in the art to whichthe present invention pertains by referencing the detailed descriptionof the present invention given below.

According to an aspect of the present invention, there is provided amethod of detecting a repetitive pattern. The method includes:clustering a plurality of pixels that form an input image according tocolor and obtaining one or more color layers composed of pixels includedin each cluster; selecting one or more effective layers from the colorlayers, wherein each of the effective layers includes a predeterminednumber or more of pixel components, each composed of a plurality ofpixels and having a predetermined shape or a predetermined size of area;selecting a unit pattern repeatedly disposed at different locations ineach effective layer from the pixel components included in eacheffective layer; calculating distances between the unit patterns in eacheffective layer; and calculating a repetition cycle of the unit patternof the input image based on the calculated distances in each effectivelayer.

BRIEF DESCRIPTION OF THE DRAWINGS

The above and other aspects and features of the present invention willbecome more apparent by describing in detail exemplary embodimentsthereof with reference to the attached drawings, in which:

FIG. 1 is a block diagram of an apparatus for detecting a repetitivepattern according to an embodiment of the present invention;

FIG. 2 is a flowchart illustrating a method of detecting a repetitivepattern according to another embodiment of the present invention;

FIG. 3 illustrates an input image according to another embodiment of thepresent invention;

FIG. 4 is a flowchart illustrating color clustering according to anotherembodiment of the present invention;

FIG. 5 illustrates the result of color clustering according to anotherembodiment of the present invention;

FIG. 6 is a flowchart illustrating a process of selecting one or moreeffective layers according to another embodiment of the presentinvention;

FIG. 7 illustrates effective layers selected according to anotherembodiment of the present invention;

FIG. 8 is a flowchart illustrating a process of selecting a unit patternaccording to another embodiment of the present invention;

FIG. 9 illustrates unit patterns according to another embodiment of thepresent invention;

FIG. 10 is a flowchart illustrating part of a process of calculating arepetition cycle of a unit pattern according to another embodiment ofthe present invention;

FIG. 11 illustrates a pattern image formed according another embodimentof the present invention;

FIG. 12 illustrates a process of detecting a defect by comparing apattern image and a test image according another embodiment of thepresent invention;

FIG. 13 is a block diagram of an apparatus for detecting a repetitivepattern according to another embodiment of the present invention;

FIG. 14 is a flowchart illustrating a method of detecting a repetitivepattern according to another embodiment of the present invention;

FIG. 15 illustrates an input image according to another embodiment ofthe present invention;

FIG. 16 illustrates a distribution matrix according to anotherembodiment of the present invention; and

FIG. 17 illustrates a frequency matrix according to another embodimentof the present invention.

DETAILED DESCRIPTION OF THE INVENTION

Advantages and features of the present invention and methods ofaccomplishing the same may be understood more readily by reference tothe following detailed description of exemplary embodiments and theaccompanying drawings. The present invention may, however, be embodiedin many different forms and should not be construed as being limited tothe embodiments set forth herein. Rather, these embodiments are providedso that this disclosure will be thorough and complete and will fullyconvey the concept of the invention to those skilled in the art, and thepresent invention will only be defined by the appended claims. Likereference numerals refer to like elements throughout the specification.

It will be understood that when an element is referred to as being“connected to” or “coupled to” another element, it can be directlyconnected or coupled to the other element or intervening elements may bepresent. In contrast, when an element is referred to as being “directlyconnected to” or “directly coupled to” another element, there are nointervening elements present. Like reference numerals refer to likeelements throughout the specification. As used herein, the term “and/or”includes any and all combinations of one or more of the associatedlisted items.

It will be understood that, although the terms first, second, third,etc., may be used herein to describe various elements, components and/orsections, these elements, components and/or sections should not belimited by these terms. These terms are only used to distinguish oneelement, component or section from another element, component orsection. Thus, a first element, component or section discussed belowcould be termed a second element, component or section without departingfrom the teachings of the present invention.

The terminology used herein is for the purpose of describing particularembodiments only and is not intended to be limiting of the invention. Asused herein, the singular forms “a”, “an” and “the” are intended toinclude the plural forms as well, unless the context clearly indicatesotherwise. It will be further understood that the terms “comprises”and/or “comprising,” when used in this specification, specify thepresence of stated components, steps, operations, and/or elements, butdo not preclude the presence or addition of one or more othercomponents, steps, operations, elements, and/or groups thereof.

Unless otherwise defined, all terms (including technical and scientificterms) used herein have the same meaning as commonly understood by oneof ordinary skill in the art to which this invention belongs. It will befurther understood that terms, such as those defined in commonly useddictionaries, should be interpreted as having a meaning that isconsistent with their meaning in the context of the relevant art andwill not be interpreted in an idealized or overly formal sense unlessexpressly so defined herein.

FIG. 1 is a block diagram of an apparatus for detecting a repetitivepattern according to an embodiment of the present invention. Referringto FIG. 1, the repetitive pattern detection apparatus includes a colorclustering unit 12 which obtains one or more color layers by performingclustering, an effective layer selection unit 13 which selects one ormore effective layers from the color layers, a unit pattern detectionunit 14 which selects a unit pattern in each effective layer, and arepetition cycle calculation unit 15 which calculates distances betweenthe unit patterns in each effective layer and calculates a patternrepetition cycle based on the calculated distances in each effectivelayer. The repetitive pattern detection apparatus receives an inputimage 11 and calculates a repetition cycle 16 using the abovecomponents.

FIG. 2 is a flowchart illustrating a method of detecting a repetitivepattern according to another embodiment of the present invention.

Referring to FIG. 2, the color clustering unit 12 clusters a pluralityof pixels, which form an input image, according to color and obtains oneor more color layers composed of pixels included in each cluster(operation S21).

Specifically, FIG. 3 illustrates an input image 31 according to anotherembodiment of the present invention. FIG. 4 is a flowchart illustratingthe clustering of the pixels according to color (i.e., color clustering)(operation S21) according to another embodiment of the presentinvention. Referring to FIG. 3, the input image 31 may include variouscolors of shapes composed of a plurality of pixels. Some of these shapesmay be arranged at regular intervals to form a pattern, and the othershapes may be distributed irregularly. Referring to FIG. 4, the colorclustering unit 12 clusters a plurality of pixels, which form an inputimage 41, according to color in order to obtain an image composed onlyof pixels of a similar color. Here, since information about colordistribution of the input image 41 is generally not provided in advance,mean shift clustering may be used. In mean shift clustering, arepresentative value for color information values (e.g., RGB values) ofpixels is selected, and a cluster is formed using the representativevalue. Accordingly, one or more color layers 43 composed of pixelsincluded in each cluster are obtained.

FIG. 5 illustrates the result of color clustering according to anotherembodiment of the present invention. That is, the color clustering of aninput image according to an embodiment of the present invention mayproduce a first color layer 51, a second color layer 52, a third colorlayer 53, a fourth color layer 54, and a fifth color layer 55.

Referring back to FIG. 2, the effective layer selection unit 13 selectsone or more effective layers from the color layers (operation S22). Eachof the effective layers includes a predetermined number or more of pixelcomponents, each composed of a plurality of pixels and having apredetermined shape or a predetermined size of area. Only necessarycolor layers (excluding unnecessary color layers) for detecting arepetitive pattern are selected from the color layers obtained inoperation S21.

FIG. 6 is a flowchart illustrating the selecting of the effective layers(operation S22) according to another embodiment of the presentinvention. The selecting of the effective layers (operation S22)according to the current embodiment may include the followingoperations. First, connected component labeling (CCL) is performed oneach of the color layers obtained in operation S21 to obtain pixelcomponents S_(ij) (operation S61). Specifically, if n (n is an integerof 1 or more) color layers are obtained in operation S21 according to anembodiment of the present invention, an i^(th) (i is an integer of 1 ton) color layer may include m (m is an integer of one or more) types ofpixel components. For example, the second color layer 52 illustrated inFIG. 5 includes two types of pixel components, that is, parallelogrampixel components and circular pixel components. Ultimately, each of thepixel components S_(ij) is a j^(th) (j is an integer of 1 to m) pixelcomponent included in the i^(th) color layer. Next, features of theobtained pixel components S_(ij) are extracted (operation S62).Specifically, at least one of an area A(S_(ij)), contours, a perimeterlength P(S_(ij)), a pair of eigenvalues λ₁ ^(ij) and λ₂ ^(ij), and apair of eigenvectors e₁ ^(ij) and e₂ ^(ij) of each of the pixelcomponents S_(ij) is obtained (operation S62). Here, the pair ofeigenvalues λ₁ ^(ij) and λ₂ ^(ij) and the pair of eigenvectors e₁ ^(ij)and e₂ ^(ij) may be obtained through, e.g., principal componentanalysis.

After the features of the pixel components S_(ij) are extracted, a pixelcomponent having a predetermined shape or a predetermined size of areais selected as an effective pixel component S_(ij) ^(a). Thepredetermined shape may be, but is not limited to, a circle, a square,or a triangle. In an embodiment for selecting a circular pixelcomponent, a pixel component whose ratio of the pair of eigenvalues λ₁^(ij) and λ₂ ^(ij) satisfies the following condition (that is, has avalue close to one) may be selected as an effective pixel component(operation S63):λ₁ ^(ij)/λ₂ ^(ij)≈1.

In another embodiment of the present invention, a pixel component whoseratio of the pair of eigenvalues λ₁ ^(ij) and λ₂ ^(ij) is in a range of0.5 to 1 may be selected as an effective pixel component. In anotherembodiment of the present invention, a pixel component whose ratio ofthe pair of eigenvalues λ₁ ^(ij) and λ₂ ^(ij) is in a range of 0.7 to 1,0.8 to 1, or 0.9 to 1 may be selected as an effective pixel component.

In an embodiment for selecting a pixel component having a predeterminedsize of area, a pixel component whose area A(S_(ij)) satisfies thefollowing condition may be selected as an effective pixel component(operation S64):A(S _(ij))>T _(A)&&A(S _(ij))>αP(S _(ij)),

where TA is a value that can be determined in a specific process (e.g.,a value equal to or less than 1% of the size of an input image), andαP(S_(ij)) is a predetermined rate of the perimeter length P(S_(ij)) ofa pixel component S_(ij) (e.g., α may have a value of one or more).

As described above, a color layer including a predetermined number ormore of such effective pixel components is selected as an effectivelayer. For example, a color layer including two or more effective pixelcomponents may be selected as an effective layer. FIG. 7 illustrateseffective layers selected according to another embodiment of the presentinvention. That is, a first effective layer 72, a second effective layer73, and a third effective layer 74 may be selected according to thecurrent embodiment of the present invention.

Referring back to FIG. 2, the unit pattern detection unit 14 selects aunit pattern repeatedly disposed at different locations in eacheffective layer from pixel components (i.e., effective pixel componentsS_(ij) ^(a)) included in each effective layer (operation S23). The unitpattern may be selected based on a cost function value used to evaluatethe feature similarity between the pixel components S_(ij) ^(a). Here,the feature similarity may refer to similarity in at least one of thefeatures (e.g., the area A(S_(ij)), contours, perimeter lengthP(S_(ij)), eigenvalues λ₁ ^(ij) and λ₂ ^(ij), and eigenvectors e₁ ^(ij)and e₂ ^(ij) of each pixel component S_(ij) ^(a)) extracted in operationS62. Specifically, similarity may be evaluated based on a cost functionvalue calculated by comparing two arbitrary pixel components S_(ij)^(a). For example, a unit pattern may be selected based on a costfunction value calculated by comparing and matching overlapping regionsof two arbitrary pixel components S_(ij) ^(a). The unit pattern may alsobe selected based on a cost function value calculated by comparing andmatching contours of two arbitrary pixel components S_(ij) ^(a).

FIG. 8 is a flowchart illustrating the selecting of the unit pattern(operation S23) according to another embodiment of the presentinvention. Referring to FIG. 8, the feature similarity between eachpixel component S_(ij) ^(a) and another pixel component S_(ij) ^(a) isevaluated as described above (operation S81). When a cost function valuecalculated by comparing and matching features of two arbitrary pixelcomponents is equal to or less than a predetermined threshold value T,the two pixel components may be treated as unit patterns that form arepetitive pattern of an input image. Accordingly, a pixel componentS_(ijR) ^(a) (hereinafter, referred to as a ‘right neighbor’) which isclosest to the right of each pixel component S_(ij) ^(a) and whose costfunction value is equal to or less than the predetermined thresholdvalue T may be selected, and a pixel component S_(ijB) ^(a)(hereinafter, referred to as a ‘lower neighbor’) which is the closestpixel component under each pixel component S_(ij) ^(a) and whose costfunction value is equal to or less than the predetermined thresholdvalue T may be selected. The selected pixel components S_(ij) ^(a) areunit patterns of a pattern detected in an input image.

Referring back to FIG. 2, the repetition cycle calculation unit 15calculates distances between unit patterns in each effective layer(operation S24) and calculates a repetition cycle of the unit pattern inthe input image based on the calculated distances in each effectivelayer (operation S25). Specifically, a distance between each pixelcomponent S_(ij) ^(a) and the right neighbor S_(ijR) ^(a) and a distancebetween each pixel component S_(ij) ^(a) and the lower neighbor S_(ijB)^(a) may be calculated in operation S24. FIG. 9 illustrates unitpatterns according to another embodiment of the present invention.Referring to FIG. 9, a layer 93 includes a square pixel component S_(ij)^(a) connected to each of a right neighbor S_(ijR) ^(a) and a lowerneighbor S_(ijB) ^(a) by a straight line. That is, in the layer 93, thesquare pixel component S_(ij) ^(a) is a unit pattern, and a length ofthe straight line is a distance between unit patterns. In most cases,the distance is a repetition cycle of the unit pattern. However, in somecases where, e.g., some pixel components are missing, some of distancevalues between unit patterns may be different from the repetition cycleof the unit pattern.

Therefore, in an embodiment of the present invention, a median value ofdistance values between unit patterns is used to calculate a correctrepetition cycle of the unit pattern. FIG. 10 is a flowchartillustrating part of the calculating of the repetition cycle of the unitpattern (operation S25) according to another embodiment of the presentinvention. Referring to FIG. 10, the calculating of the repetition cycleof the unit pattern (operation S25) includes calculating a first medianvalue (d_(iH) ^(a), d_(iV) ^(a)) of all distances between unit patternsdetected in a first layer (operations S101 and S102). Operation S25further includes calculating a second median value of all distancesbetween unit patterns detected in a second layer and determining a thirdmedian value of the first median value and the second median value to bea repetition cycle.

FIG. 11 illustrates a pattern image 111 formed according to anotherembodiment of the present invention. The pattern image 111 illustratedin FIG. 11 has been formed using a pattern and a repetition cycle of theunit pattern obtained using the above-described method. In particular, apattern such as a region 112 is repeated twice in horizontal andvertical directions.

FIG. 12 illustrates a process of detecting a defect by comparing apattern image 121 and a test image 122 according to another embodimentof the present invention. Referring to FIG. 12, the pattern image 121constructed using the above-described method is compared with the testimage 122 to detect any possible defect in the test image 122.

According to the above embodiment of the present invention, a defect ina test image can be detected by visual detection without a referenceimage by detecting a repetitive pattern in an input image. In addition,a defect in a test image can be detected using a given input imagewithout the need to create a reference image suitable for each unitprocess. Therefore, various defects generated in various processes canbe flexibly dealt with. Furthermore, even when some processes arechanged or when a different type of substrate is used, defects can bedetected flexibly and rapidly.

Until now, an embodiment of a method and apparatus for detecting arepetitive pattern in a case where a unit pattern has an arbitrary shapehas been described. An embodiment of a method and apparatus fordetecting a repetitive pattern in a case where a unit pattern iscircular will now be described.

FIG. 13 is a block diagram of an apparatus for detecting a repetitivepattern according to another embodiment of the present invention.Referring to FIG. 13, the repetitive pattern detection apparatusincludes a linear pixel component removal unit 132 which removes linearpixel components by performing edge detection, a circular pixelcomponent detection unit 133 which detects circular pixel components, adistribution matrix creation unit 134 which creates a distributionmatrix by setting a grid and placing the circular pixel components inthe grid, and a repetition cycle calculation unit 135 which calculatesdistances between the circular pixel components and a pattern repetitioncycle. The repetitive pattern detection apparatus receives an inputimage 131 and calculates a repetition cycle 136 using the abovecomponents.

FIG. 14 is a flowchart illustrating a method of detecting a repetitivepattern according to another embodiment of the present invention.

Referring to FIG. 14, to detect circular unit patterns in an inputimage, the linear pixel component removal unit 13 removes linear pixelcomponents, which are lines formed by a plurality of pixels, from theinput image by performing edge detection on pixels that form the inputimage (operation S141). Edge detection of the input image makes it easyto detect linear or circular pixel components in the input image. Foredge detection of the input image, a Gaussian blurring filter or a cannyedge detector may be used. After the edge detection, linear pixelcomponents are removed from the input image.

Next, circular pixel components, which are circles formed by a pluralityof pixels, are detected in the input image without the linear pixelcomponents (operation S142). In operation S142, a Hough transform may beperformed on the input image without the linear pixel components so asto detect the circular pixel components.

However, since the Hough transform may generate noise, a circular pixelcomponent can be wrongly detected. To prevent this problem, a crosscorrelation matrix used to evaluate the correlation between eachcircular pixel component and another circular pixel component may becreated to detect circular pixel components. The cross correlationmatrix includes a similarity value between each circular pixel componentand another circular pixel component as its element. As the similarityvalue between each circular pixel component and another circular pixelcomponent increases, the element of the cross correlation matrix mayhave a greater value. Conversely, as the similarity value between eachcircular pixel component and another circular pixel component decreases,the element of the cross correlation matrix may have a smaller value.Therefore, a circular pixel component corresponding to an element havinga predetermined value or less may be determined to have been wronglydetected and thus removed from pixel components from which a repetitivepattern is to be detected.

FIG. 15 illustrates an input image 151 according to another embodimentof the present invention. The input image 151 includes circular pixelcomponents 152 and a pixel component 154 wrongly detected as a circularpixel component. A non-existent region 153 is a region in which acircular pixel component is likely to exist in view of the regularity ofa pattern but does not actually exist.

Referring back to FIG. 14, a grid of square cells that form a pluralityof rows and a plurality of columns is set in an image, and adistribution matrix is formed by placing circular pixel components inthe cells of the grid (operation S143). Specifically, a grid of aplurality of square cells that form a plurality of rows and a pluralityof columns is set in an input image 161. Then, a distribution matrix isformed by placing circular pixel components in the cells of the grid.FIG. 16 illustrates a distribution matrix according to anotherembodiment of the present invention. In FIG. 16, a grid of 400 squarecells that form 20 rows and 20 columns is set, and circular pixelcomponents 162 through 164 are distributed in one column of the grid.

In a case where a distribution matrix is formed by placing circularpixel components in a grid set in an input image, circular pixelcomponents may not be placed at all in some columns of the grid. Sincethe columns without circular pixel components include empty grid cellsonly, they may be removed in order to prevent unnecessary calculation ina repetitive pattern detection process. By removing columns unnecessaryfor the repetitive pattern detection process from the distributionmatrix, a compact distribution matrix can be created.

Referring back to FIG. 14, distances between the circular pixelcomponents are measured (operation S144), and a repetition cycle of thecircular pixel components in the input image is calculated (operationS145). First, distances between circular pixel components in one of thecolumns are measured, and a frequency matrix having values of thedistances as its elements is created. In an embodiment of the presentinvention, a distance between circular pixel components may be measuredas the number of square cells between the circular pixel components.

Next, a histogram of the elements of the frequency matrix is analyzed,and an element value having a greatest frequency is determined to be arepetition cycle. For example, FIG. 17 illustrates a frequency matrixaccording to another embodiment of the present invention. In a secondcolumn of the frequency matrix, an element having a value of 5 and anelement having a value of 10 are arranged. Referring to FIG. 16, adistance between the circular pixel components 163 and 164 is 5, and adistance between the circular pixel components 162 and 163 is 10.

That is, the distance between the circular pixel components 162 and 163is measured to be 10 due to a region in which a circular pixel componentis likely to exist in view of the regularity of a pattern but does notactually exist. This value (i.e., 10) cannot be a correct repetitioncycle value of the circular pixel component. If a histogram of thefrequency matrix of FIG. 17 is analyzed to calculate the correctrepetition cycle, it can be seen that the number of elements having avalue of 5 is far greater than the number of elements having values of3, 7 or 10. Therefore, it can be concluded that the pattern includescircular pixel components distributed in horizontal and verticaldirections at regular intervals of five.

As described above with reference to FIG. 12, a pattern imageconstructed using a repetition cycle obtained by the above-describedmethod is compared with a test image to detect any defect in the testimage.

Methods and apparatuses for detecting a repetitive pattern according tovarious embodiments of the present invention are applicable to thesemiconductor field. For example, the methods and apparatuses fordetecting a repetitive pattern according to the embodiments of thepresent invention can be used to detect defects in a wafer including aplurality of semiconductor elements or in an organic light-emittingdiode (OLED), light-emitting diode (LED) or liquid crystal display (LCD)(e.g., a TFT-LCD) related display or can be used to detect defects(e.g., a short circuit of a semiconductor element) in the semiconductorpackaging related field such as ball grid array (BGA). Specifically, arepetitive pattern may be extracted from the regular arrangement of OLEDor LED elements or LCD pixels that form a display, and then a defect inan OLED, LED or LCD (e.g., TFT-LCD) substrate may be detected without areference image. In addition, a repetitive pattern may be extracted fromthe arrangement of balls that form a grid array, and then a defect inthe BGA may be detected without a reference image. Further, a defect ina wafer including a plurality of semiconductor chips may be detectedwithout a reference image by detecting a repetitive pattern according tovarious embodiments of the present invention.

In particular, in a semiconductor process using a highly integratedpattern of semiconductor elements, a defect in a test image can bedetected by visual detection without a reference image by detecting arepetitive pattern in an input image. In addition, a defect in a testimage can be detected using a given input image without the need tocreate a reference image suitable for each unit process of thesemiconductor field. Therefore, various defects generated in variousprocesses of the semiconductor field can be flexibly dealt with.Furthermore, even when some processes are changed or when a differentsubstrate is used, defects can be detected flexibly and rapidly.

According to the present invention, a defect in a test image can bedetected by visual detection without a reference image by detecting arepetitive pattern in an input image. Therefore, even when it isdifficult to provide a reference image, a visual detection techniquethat can save production cost by detecting a defect relatively quicklyand significantly reducing a defect rate can still be used as it is.

In addition, according to the present invention, a defect in a testimage can be detected using a given input image without the need tocreate a reference image suitable for each unit process. Therefore,various defects generated in various processes can be flexibly dealtwith. Furthermore, even when some processes are changed or when adifferent type of substrate is used, defects can be detected flexiblyand rapidly.

While the present invention has been particularly shown and describedwith reference to exemplary embodiments thereof, it will be understoodby those of ordinary skill in the art that various changes in form anddetail may be made therein without departing from the spirit and scopeof the present invention as defined by the following claims. Theexemplary embodiments should be considered in a descriptive sense onlyand not for purposes of limitation.

What is claimed is:
 1. A method of detecting a repetitive pattern, themethod comprising: obtaining one or more color layers comprised of thepixels included in each cluster by clustering pixels of an input imageaccording to color; selecting one or more effective layers from thecolor layers, wherein each of the effective layers comprises at least apredetermined number of respective pixel components, each of the pixelcomponents including a plurality of pixels and having at least one of apredetermined shape and a predetermined area size; selecting a unitpattern, repeatedly disposed at different locations in each of theeffective layers, from the respective pixel components; in eacheffective layer, calculating distances between the unit patterns; andcalculating a repetition cycle of each of the unit patterns of the inputimage, based on the calculated distances, wherein at least one of theclustering, obtaining, selecting, and calculating is implemented using ahardware processor.
 2. The method of claim 1, wherein: the effectivelayers comprise a first effective layer and a second effective layer;and the calculating of the repetition cycle of each of the unit patternsof the input image, based on the calculated distances, comprises:calculating a first median value of distances between the unit patternsin the first effective layer; calculating a second median value ofdistances between the unit patterns in the second effective layer; anddetermining a third median value, of the first median value and thesecond median value, as the repetition cycle.
 3. The method of claim 1,wherein the selecting of the one or more effective layers comprises:obtaining the respective pixel components by performing connectedcomponent labeling (CCL) on each of the color layers; and obtaining atleast one of an area, contours, a perimeter length, a pair ofeigenvalues, and a pair of eigenvectors of each of the obtained pixelcomponents.
 4. The method of claim 3, wherein each of the selected oneor more effective layers is selected so as to include the respectivepixel components whose ratios of the pair of eigenvalues are in a rangeof 0.7 to 1, inclusive.
 5. The method of claim 3, wherein each of theselected one or more effective layers is selected so as to include therespective pixels components whose areas are at least a predeterminedvalue and at least a predetermined percentage of the perimeter length.6. The method of claim 1, wherein the unit pattern is selected based ona cost function value for evaluating a feature similarity between eachof the pixel components and another one of the pixel components.
 7. Themethod of claim 6, wherein the feature similarity is evaluated bycomparing at least one of the area, contours, perimeter length, pair ofeigenvalues and pair of eigenvectors of each of the pixel components,and the selecting of the unit pattern is based on the calculated costfunction value.
 8. The method of claim 6, wherein the feature similarityis evaluated by comparing overlapping regions of the pixel components,and the selecting of the unit pattern is based on the calculated costfunction value.
 9. The method of claim 1, wherein the obtaining of theone or more color layers comprises performing mean shift clustering, onthe pixels that form the input image, according to color.
 10. The methodof claim 1, further comprising: forming a pattern image using the unitpattern and the repetition cycle; and detecting a defect in a test imageby comparing the test image with the pattern image.
 11. An apparatus fordetecting a repetitive pattern, the apparatus comprising: a colorclustering unit configured to cluster pixels of an input image accordingto color, and configured to obtain one or more color layers comprised ofthe pixels included in each cluster; an effective layer selection unitconfigured to select one or more effective layers from the color layers,wherein each of the effective layers comprises at least a predeterminednumber of respective pixel components, each of the pixel componentsincluding a plurality of pixels and having at least one of apredetermined shape and a predetermined area size; a unit patterndetection unit configured to select a unit pattern, repeatedly disposedat different locations in each of the effective layers, from therespective pixel components; and a repetition cycle calculation unitconfigured to calculate distances between the unit patterns in eacheffective layer, and configured to calculate a repetition cycle of theunit pattern of the input image, based on the calculated distances;wherein the color clustering unit, the effective layer selection unit,the unit pattern detection unit, and the repetition cycle calculationunit are implemented by at least one hardware processor.